package com.kalaqia.gradle.jiagu;

/**
 * function:
 * project:AutoBuildGradlePlugin
 * describe:
 * created owner:kalaqia 421407393@qq.com
 * created date:2018/1/3 17:41.
 */
class JiaGu360Script {

    static String bat() {
        return """
set APK=%1
set DEST=%2
set IS_CHANNEL=%3
set JAR_PATH=%4
set ACCOUNT=%5
set PASSWORD=%6
set SIGN=%~7

echo %APK%
echo "------ JiaGu  running..."

md %DEST%
java -jar %JAR_PATH%jiagu.jar -login %ACCOUNT% %PASSWORD%
java -jar %JAR_PATH%jiagu.jar -importsign %SIGN%

if "%IS_CHANNEL%"=="1" (java -jar %JAR_PATH%jiagu.jar -importmulpkg ../jiagu/channels.txt)

java -jar %JAR_PATH%jiagu.jar -showsign

set pack=" "

if "%IS_CHANNEL%"=="1" (set pack=-automulpkg)

if NOT exist %APK% (echo "file not found :%APK%" && goto :jiaGuFailed)

if NOT exist %DEST% (echo "file not found :%DEST%" && goto :jiaGuFailed)

java -jar %JAR_PATH%jiagu.jar  -jiagu %APK% %DEST% -autosign %pack%
goto jiaGuSuccess

rem #######################################################################################

:jiaGuSuccess
echo JIAGU SUCCESS!!
goto end

:jiaGuFailed
echo JiaGu FAILED!!
goto end

:end
echo "------ JiaGu  finished!"
"""
    }

}
